﻿using System;
using System.Collections.Generic;
using System.Linq.Expressions;

namespace Dapper.Library
{
    public interface ICommandSet<T>
    {

        /// <summary>
        /// 增加Or开头的Where条件
        /// </summary>
        /// <param name="predicate"></param>
        /// <returns></returns>
        ICommand<T> OrWhere(Expression<Func<T, bool>> predicate);

        /// <summary>
        /// 增加And开头的Where条件
        /// </summary>
        /// <param name="predicate"></param>
        /// <returns></returns>
        ICommand<T> AndWhere(Expression<Func<T, bool>> predicate);

        /// <summary>
        /// 判断是否存在
        /// </summary>
        /// <param name="predicate"></param>
        /// <returns></returns>
        ICommand<T> IfNotExists(Expression<Func<T, bool>> predicate);

        /// <summary>
        /// 批量插入
        /// </summary>
        /// <param name="entities"></param>
        /// <param name="timeout"></param>
        void BatchInsert(IEnumerable<T> entities, int timeout = 120);
    }
}
